﻿USE [DLM]
GO
/****** Object:  Table [dbo].[AdminUser]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[AdminUser](
	[AdminID] [int] IDENTITY(1,1) NOT NULL,
	[Administrator] [nvarchar](30) NOT NULL,
	[Password] [varchar](20) NOT NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_AdminUser] PRIMARY KEY CLUSTERED 
(
	[AdminID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[AdminLog]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[AdminLog](
	[LogID] [int] IDENTITY(1,1) NOT NULL,
	[Action] [nvarchar](20) NOT NULL,
	[ActionDate] [datetime] NOT NULL,
	[ActionSourceIP] [varchar](20) NULL,
 CONSTRAINT [PK_AdminLog] PRIMARY KEY CLUSTERED 
(
	[LogID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Account]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Account](
	[AccountID] [int] IDENTITY(1,1) NOT NULL,
	[AccountName] [nvarchar](50) NOT NULL,
	[Password] [varchar](30) NOT NULL,
	[Email] [varchar](30) NOT NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED 
(
	[AccountID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Account] ON
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (1, N'ww', N'111', N'111', CAST(0x0000A02E015A6655 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (2, N'ww', N'11', N'11', CAST(0x0000A02E015B28E4 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (3, N'222', N'222', N'22', CAST(0x0000A02E015D85BF AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (4, N'111', N'11', N'11', CAST(0x0000A02E015FAD7B AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (5, N'22', N'22', N'22', CAST(0x0000A02E01661AAE AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (6, N'22', N'22', N'22', CAST(0x0000A02E01661AAE AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (7, N'33', N'33', N'22', CAST(0x0000A02E01669484 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (8, N'33', N'33', N'22', CAST(0x0000A02E01669484 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (9, N'555', N'555', N'555', CAST(0x0000A02E01673863 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (11, N'33', N'33', N'33', CAST(0x0000A02E01748785 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (12, N'55', N'55', N'55', CAST(0x0000A02E0174B643 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (13, N'66', N'66', N'66', CAST(0x0000A02E01751AF0 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (14, N'weiwei', N'111', N'111', CAST(0x0000A02F015FF828 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (15, N'11111', N'111', N'111', CAST(0x0000A02F018681A9 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (16, N'22', N'22', N'22', CAST(0x0000A03000032966 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (17, N'tommy', N'111', N'111', CAST(0x0000A03001085DC5 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (18, N'oyjd', N'111', N'11', CAST(0x0000A03200F60B70 AS DateTime))
INSERT [dbo].[Account] ([AccountID], [AccountName], [Password], [Email], [CreateDate]) VALUES (19, N'ccx', N'111', N'111', CAST(0x0000A03200F7C0AC AS DateTime))
SET IDENTITY_INSERT [dbo].[Account] OFF
/****** Object:  Table [dbo].[Party]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Party](
	[PartyID] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NOT NULL,
	[PartyType] [int] NOT NULL,
	[Subject] [nvarchar](30) NOT NULL,
	[PhotoUrl] [nvarchar](20) NULL,
	[Modality] [nvarchar](20) NULL,
	[PartyDate] [datetime] NULL,
	[Location] [nvarchar](100) NULL,
	[Address] [nvarchar](150) NULL,
	[MemberCount] [int] NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Party] PRIMARY KEY CLUSTERED 
(
	[PartyID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Party] ON
INSERT [dbo].[Party] ([PartyID], [Status], [PartyType], [Subject], [PhotoUrl], [Modality], [PartyDate], [Location], [Address], [MemberCount], [CreateDate]) VALUES (1, 0, 1, N'1', N'1', N'1', CAST(0x00009FEB00000000 AS DateTime), N'2', N'2', 2, CAST(0x0000A03000D21B77 AS DateTime))
INSERT [dbo].[Party] ([PartyID], [Status], [PartyType], [Subject], [PhotoUrl], [Modality], [PartyDate], [Location], [Address], [MemberCount], [CreateDate]) VALUES (2, 0, 1, N'1', N'1', N'1', CAST(0x00009E7E00000000 AS DateTime), N'2', N'2', 2, CAST(0x0000A030010A66E4 AS DateTime))
INSERT [dbo].[Party] ([PartyID], [Status], [PartyType], [Subject], [PhotoUrl], [Modality], [PartyDate], [Location], [Address], [MemberCount], [CreateDate]) VALUES (3, 0, 2, N'ccx', N'22', N'22', CAST(0x0000A03200000000 AS DateTime), N'22', N'22', 2, CAST(0x0000A03200F81C2F AS DateTime))
SET IDENTITY_INSERT [dbo].[Party] OFF
/****** Object:  Table [dbo].[Message]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Message](
	[MessageID] [int] NOT NULL,
 CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED 
(
	[MessageID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Log]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Log](
	[LogID] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NOT NULL,
	[Level] [varchar](50) NULL,
	[Logger] [varchar](255) NULL,
	[Source] [nvarchar](255) NULL,
	[Message] [nvarchar](255) NULL,
 CONSTRAINT [PK_SystemLog] PRIMARY KEY CLUSTERED 
(
	[LogID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[EmailInvitation]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[EmailInvitation](
	[ID] [int] NOT NULL,
	[UserID] [int] NOT NULL,
	[Email] [varchar](25) NOT NULL,
	[Content] [text] NULL,
	[PartyID] [int] NOT NULL,
	[PartySubject] [nvarchar](30) NULL,
	[IsSent] [bit] NOT NULL,
	[SendDate] [datetime] NOT NULL,
 CONSTRAINT [PK_EmailInvitation] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Country]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Country](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Country] [nvarchar](15) NULL,
	[Province] [nvarchar](15) NULL,
	[City] [nvarchar](10) NULL,
	[Zone] [nvarchar](10) NULL,
	[ParentId] [int] NULL,
 CONSTRAINT [PK_Country] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Remark]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Remark](
	[RemarkID] [int] IDENTITY(1,1) NOT NULL,
	[PartyID] [int] NOT NULL,
	[Content] [nvarchar](100) NULL,
	[UserID] [int] NOT NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Remark] PRIMARY KEY CLUSTERED 
(
	[RemarkID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[User]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[User](
	[UserID] [int] IDENTITY(1,1) NOT NULL,
	[AccountID] [int] NOT NULL,
	[Name] [nvarchar](20) NULL,
	[Gender] [bit] NULL,
	[Birthday] [datetime] NULL,
	[Age] [smallint] NULL,
	[HomePlace] [nvarchar](30) NULL,
	[Marriage] [bit] NULL,
	[NativePlace] [nvarchar](40) NULL,
	[Stature] [nvarchar](10) NULL,
	[Weight] [int] NULL,
	[Education] [nvarchar](10) NULL,
	[Job] [nvarchar](20) NULL,
	[Income] [decimal](10, 2) NULL,
	[Position] [nvarchar](20) NULL,
	[Industry] [nvarchar](50) NULL,
	[Car] [bit] NULL,
	[Parents] [nvarchar](20) NULL,
	[Photo] [nvarchar](50) NULL,
	[Phone] [varchar](15) NULL,
	[IM] [varchar](18) NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [UQ_User_AccountID] UNIQUE NONCLUSTERED 
(
	[AccountID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[User] ON
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (1, 5, NULL, 0, NULL, NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, N'222', CAST(0x0000A02E01661CF4 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (2, 6, NULL, 0, NULL, NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E01661E19 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (3, 7, NULL, 0, NULL, NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E016695CB AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (4, 8, NULL, 0, NULL, NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E016695CB AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (5, 9, NULL, 0, NULL, NULL, NULL, NULL, NULL, N'555', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E01673863 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (7, 11, NULL, 1, NULL, NULL, NULL, NULL, NULL, N'33', NULL, NULL, NULL, CAST(1.00 AS Decimal(10, 2)), NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E01748785 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (8, 12, NULL, 1, NULL, NULL, NULL, NULL, NULL, N'55', NULL, NULL, NULL, CAST(1.00 AS Decimal(10, 2)), NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E0174B643 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (9, 13, NULL, 1, NULL, NULL, NULL, NULL, NULL, N'66', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02E01751AF0 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (10, 14, NULL, 1, NULL, NULL, NULL, NULL, NULL, N'111', NULL, NULL, NULL, CAST(22.00 AS Decimal(10, 2)), NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02F015FF828 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (11, 15, NULL, 1, CAST(0x00009FEB00000000 AS DateTime), 22, NULL, NULL, NULL, N'111', NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A02F018681A9 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (12, 16, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A03000032966 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (13, 17, N'tommy', 0, CAST(0x00009E5E00000000 AS DateTime), 22, NULL, NULL, NULL, N'11', NULL, NULL, NULL, NULL, N'22', NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A03001085CF4 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (14, 18, N'oyjd', 1, CAST(0x00009FEB00000000 AS DateTime), 2, NULL, NULL, NULL, N'11', NULL, NULL, NULL, NULL, N'2', NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A03200F60B71 AS DateTime))
INSERT [dbo].[User] ([UserID], [AccountID], [Name], [Gender], [Birthday], [Age], [HomePlace], [Marriage], [NativePlace], [Stature], [Weight], [Education], [Job], [Income], [Position], [Industry], [Car], [Parents], [Photo], [Phone], [IM], [CreateDate]) VALUES (15, 19, N'ccx', 1, CAST(0x00009FEB00000000 AS DateTime), 22, NULL, NULL, NULL, N'111', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'test', NULL, NULL, CAST(0x0000A03200F7C0AC AS DateTime))
SET IDENTITY_INSERT [dbo].[User] OFF
/****** Object:  Table [dbo].[UserView]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserView](
	[ViewID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NOT NULL,
	[IP] [varchar](20) NULL,
	[ViewDate] [datetime] NOT NULL,
 CONSTRAINT [PK_UserView] PRIMARY KEY CLUSTERED 
(
	[ViewID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserPartyAssociation]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserPartyAssociation](
	[UPAID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NOT NULL,
	[PartyID] [int] NOT NULL,
	[IsLead] [bigint] NULL,
 CONSTRAINT [PK_UserPartyAssociation] PRIMARY KEY CLUSTERED 
(
	[UPAID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[UserPartyAssociation] ON
INSERT [dbo].[UserPartyAssociation] ([UPAID], [UserID], [PartyID], [IsLead]) VALUES (1, 13, 2, 1)
INSERT [dbo].[UserPartyAssociation] ([UPAID], [UserID], [PartyID], [IsLead]) VALUES (2, 13, 1, 0)
INSERT [dbo].[UserPartyAssociation] ([UPAID], [UserID], [PartyID], [IsLead]) VALUES (3, 15, 3, 1)
INSERT [dbo].[UserPartyAssociation] ([UPAID], [UserID], [PartyID], [IsLead]) VALUES (4, 14, 3, 0)
INSERT [dbo].[UserPartyAssociation] ([UPAID], [UserID], [PartyID], [IsLead]) VALUES (5, 15, 3, 0)
SET IDENTITY_INSERT [dbo].[UserPartyAssociation] OFF
/****** Object:  Table [dbo].[Photo]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Photo](
	[PhotoID] [int] NOT NULL,
	[UserID] [int] NOT NULL,
	[Url] [nvarchar](30) NULL,
	[Desc] [nvarchar](20) NULL,
	[IsMain] [bit] NOT NULL,
	[CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Photo] PRIMARY KEY CLUSTERED 
(
	[PhotoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Bonus]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Bonus](
	[BonusID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NOT NULL,
	[Bonus] [decimal](10, 2) NULL,
 CONSTRAINT [PK_Bonus] PRIMARY KEY CLUSTERED 
(
	[BonusID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [UQ_Bonus_UserID] UNIQUE NONCLUSTERED 
(
	[UserID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Invitation]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Invitation](
	[InvitationID] [int] IDENTITY(1,1) NOT NULL,
	[PartyID] [int] NOT NULL,
	[UserID] [int] NOT NULL,
	[IsConfirmed] [bit] NOT NULL,
	[InviteDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Invitation] PRIMARY KEY CLUSTERED 
(
	[InvitationID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Friend]    Script Date: 04/20/2012 09:50:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Friend](
	[FriendID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[MyFriendID] [image] NOT NULL,
	[CreateDate] [datetime] NOT NULL,
	[IsConfirmed] [bit] NOT NULL,
 CONSTRAINT [PK_Friend] PRIMARY KEY CLUSTERED 
(
	[FriendID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_Bonus_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[Bonus]  WITH CHECK ADD  CONSTRAINT [FK_Bonus_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[Bonus] CHECK CONSTRAINT [FK_Bonus_User]
GO
/****** Object:  ForeignKey [FK_Friend_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[Friend]  WITH CHECK ADD  CONSTRAINT [FK_Friend_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[Friend] CHECK CONSTRAINT [FK_Friend_User]
GO
/****** Object:  ForeignKey [FK_Invitation_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[Invitation]  WITH CHECK ADD  CONSTRAINT [FK_Invitation_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[Invitation] CHECK CONSTRAINT [FK_Invitation_User]
GO
/****** Object:  ForeignKey [FK_Photo_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[Photo]  WITH CHECK ADD  CONSTRAINT [FK_Photo_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[Photo] CHECK CONSTRAINT [FK_Photo_User]
GO
/****** Object:  ForeignKey [FK_User_Account]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[User]  WITH CHECK ADD  CONSTRAINT [FK_User_Account] FOREIGN KEY([AccountID])
REFERENCES [dbo].[Account] ([AccountID])
GO
ALTER TABLE [dbo].[User] CHECK CONSTRAINT [FK_User_Account]
GO
/****** Object:  ForeignKey [FK_UserPartyAssociation_Party]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[UserPartyAssociation]  WITH CHECK ADD  CONSTRAINT [FK_UserPartyAssociation_Party] FOREIGN KEY([PartyID])
REFERENCES [dbo].[Party] ([PartyID])
GO
ALTER TABLE [dbo].[UserPartyAssociation] CHECK CONSTRAINT [FK_UserPartyAssociation_Party]
GO
/****** Object:  ForeignKey [FK_UserPartyAssociation_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[UserPartyAssociation]  WITH CHECK ADD  CONSTRAINT [FK_UserPartyAssociation_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[UserPartyAssociation] CHECK CONSTRAINT [FK_UserPartyAssociation_User]
GO
/****** Object:  ForeignKey [FK_UserView_User]    Script Date: 04/20/2012 09:50:07 ******/
ALTER TABLE [dbo].[UserView]  WITH CHECK ADD  CONSTRAINT [FK_UserView_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([UserID])
GO
ALTER TABLE [dbo].[UserView] CHECK CONSTRAINT [FK_UserView_User]
GO
